home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / fih113.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1996-06-07  |  7KB  |  277 lines

  1. /* Icon Heaven installation script */
  2. /* (C)Copyright 1993-1996 by The Frobozz Magic Software Company */
  3.  
  4. Call RxFuncadd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  5. Call SysLoadFuncs
  6.  
  7. ver = '1.13'
  8.  
  9. app = 'IHeaven'
  10. key = 'INSTDIR'
  11.  
  12. '@echo off'
  13.  
  14. Call SysCls
  15.  
  16. say 'Icon Heaven installation utility version 'ver
  17. say '(C)Copyright 1993-1996 by the Frobozz Magic Software Company'
  18.  
  19. /* check to see if Icon Heaven is installed, if so update it */
  20.  
  21. res = SysIni(, app, key)
  22.  
  23. if res <> 'ERROR:' then do
  24.     instdir = res
  25.     call update
  26.     exit
  27. end
  28.  
  29. ini = value('USER_INI',,'OS2ENVIRONMENT')
  30.  
  31. tDrive = left(ini,1)
  32.  
  33. instdir=tDrive':\IHeaven'
  34.  
  35. dll=tDrive':\os2\dll\fim.dll'
  36.  
  37. res=stream(dll,'c','query exists')
  38.  
  39. if res<>'' then do
  40.     call update100
  41.     exit
  42. end
  43.  
  44. cur = directory()
  45.  
  46. prompt = 'Press [enter] to install in the default directory ['instdir']'
  47.  
  48. current = 0
  49.  
  50. if left(cur,1) >= 'C' then do
  51.     instdir = cur
  52.     prompt = 'Press [enter] to install in the current directory'
  53.     current = 1
  54. end
  55.  
  56. say 'Please enter the path where Icon Heaven will be installed'
  57. say prompt 
  58. pull newdir
  59.  
  60. if newdir <> '' then do
  61.     current = 0
  62.     instdir = newdir
  63. end
  64.  
  65. if length(instdir) = 3 then do
  66.      if substr(instdir,3,1) ='\' then
  67.         instdir = left(instdir,2)
  68. end
  69.  
  70. say 'Icon Heaven will be installed in ['instdir']'
  71. 'pause'
  72.  
  73. if \current then do
  74.     res = mkdir(instdir)
  75.  
  76.     if res <> 0 then do
  77.         say 'The directory ['instdir'] you specified cannot be created'
  78.         say 'installation aborted'
  79.         exit
  80.     end
  81.  
  82.     /* say 'copying fim.dll to 'instdir */
  83.     'copy fim.ico 'instdir' >nul'
  84.     'copy fim.dll 'instdir' >nul'
  85. end
  86.  
  87. retval = SysCreateObject('WPFolder', 'Icon Heaven', '<WP_DESKTOP>', 'ICONFILE='instdir'\fim.ico;OBJECTID=<FIM_ICONS>', 'R')
  88.  
  89. if SysRegisterObjectClass('FIMTransIcon', instdir'\fim.dll') then
  90.     say 'FIMTransIcon registered'
  91. else do
  92.     say 'FIMTransIcon registration failed'
  93.     call SysDestroyObject "<FIM_ICONS>"
  94.     if \current then do
  95.         'del 'instdir'\fim.dll 'instdir'\fim.ico'
  96.         call SysRmDir instdir
  97.     end
  98.     exit
  99. end
  100.  
  101. if SysRegisterObjectClass('FIMFolder', instdir'\fim.dll') then
  102.     say 'FIMFolder registered'
  103. else do
  104.     say 'FIMFolder registration failed'
  105.     call SysDeregisterObjectClass 'FIMTransIcon'
  106.     call SysDestroyObject "<FIM_ICONS>"
  107.     if \current then do
  108.         'del 'instdir'\fim.dll 'instdir'\fim.ico'
  109.         call SysRmDir instdir
  110.     end
  111.     exit
  112. end
  113.  
  114. if \current then do
  115.     /* say 'copying fim.hlp to 'instdir */
  116.     'copy fim.hlp 'instdir' >nul'
  117.     'copy iconlib.exe 'instdir' >nul'
  118.     'copy iconlib.ico 'instdir' >nul'
  119.     'copy deinstal.cmd 'instdir' >nul'
  120.     'copy deinstal.ico 'instdir' >nul'
  121.     'copy reinst.cmd 'instdir' >nul'
  122.     'copy replace.exe 'instdir' >nul'
  123.     'copy readme.1st 'instdir' >nul'
  124.     'copy bmtorder.frm 'instdir' >nul'
  125. end
  126.  
  127. retval = SysCreateObject('WPProgram', 'Icon Librarian', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;ASSOCFILTER=*.FIM;EXENAME='instdir'\iconlib.exe;ICONFILE='instdir'\iconlib.ico', 'R')
  128. retval = SysCreateObject('WPProgram', 'De-Install', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;EXENAME='instdir'\deinstal.cmd;ICONFILE='instdir'\deinstal.ico', 'R')
  129. retval = SysCreateObject('WPProgram', 'Read Me', '<FIM_ICONS>', 'PROGTYPE=PM;EXENAME=e.exe;PARAMETERS='instdir'\readme.1st', 'R')
  130.  
  131. call instlibs '.'
  132.  
  133. res = SysIni(, app, key, instdir)
  134.  
  135. say 'Installation has been succesfully completed.'
  136. if current then
  137.     'pause'
  138. else do
  139.     say 'Do you wish me to clean up the installation directory? [N/y]'
  140.     pull reply
  141.     if left(reply, 1) = 'Y' then do
  142.         call cleanup
  143.     end
  144. end
  145.  
  146. Exit
  147.  
  148.  
  149. instlibs:procedure expose current instdir
  150.  
  151. dir=ARG(1)
  152.  
  153.  
  154. call SysFileTree dir'\*.fim', 'file.', 'FO'
  155.  
  156. say 'Installing icon libraries'
  157.  
  158. Do i=1 to file.0
  159.     if current then 
  160.         targ = file.i
  161.     else do
  162.         targ = instdir'\'filespec('n',file.i)
  163.         'copy' file.i targ '>nul'
  164.     end
  165.     cookie1 = charin(targ)
  166.     cookie2 = charin(targ)
  167.     if cookie1 = 'L' & cookie2 = 'I' then do
  168.         dum = charin(targ,,8)
  169.         n = ''
  170.         c = charin(targ)
  171.         do until c2d(c) = 0
  172.             n = n''c
  173.             c= charin(targ)
  174.         end
  175.         retval = SysCreateObject('FIMFolder', n, '<FIM_ICONS>', 'ICONLIBRARY='targ, 'R')
  176.         say 'Library 'n' added'
  177.         call stream targ,'C','CLOSE'
  178.     end
  179.     else do
  180.         call stream targ,'C','CLOSE'
  181.         if \current then
  182.             'del 'targ
  183.     end
  184. End
  185.  
  186. return
  187.  
  188.  
  189. cleanup:
  190.  
  191. 'del *.fim fim.ico fim.hlp fim.dll iconlib.exe iconlib.ico'
  192. 'del readme.1st install.cmd deinstal.cmd deinstal.ico reinst.cmd'
  193. 'del replace.exe bmtorder.frm'
  194.  
  195. return
  196.  
  197.  
  198. update100:
  199.  
  200. /* update from 1.00 */
  201.  
  202. say ''
  203. say 'Icon Heaven is installed in directory ['instdir']'
  204. say 'Do you wish me to update it ? [Y/n]'
  205. pull reply
  206.  
  207. if left(reply,1)='N' then return
  208.  
  209. /* use default directory */
  210.  
  211. res = SysIni(, app, key, instdir)
  212.  
  213. 'copy fim.dll 'instdir' >nul'
  214. 'copy fim.hlp 'instdir' >nul'
  215. 'copy fim.ico 'instdir' >nul'
  216. 'copy iconlib.exe 'instdir' >nul'
  217. 'copy iconlib.ico 'instdir' >nul'
  218. 'copy readme.1st 'instdir' >nul'
  219. 'copy replace.exe 'instdir' >nul'
  220. 'copy deinstal.cmd 'instdir' >nul'
  221. 'copy deinstal.ico 'instdir' >nul'
  222. 'copy reinst.cmd 'instdir' >nul'
  223. 'copy bmtorder.frm 'instdir' > nul'
  224.  
  225. retval = SysCreateObject('WPProgram', 'Icon Librarian', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;ASSOCFILTER=*.FIM;EXENAME='instdir'\iconlib.exe;ICONFILE='instdir'\iconlib.ico', 'U')
  226. retval = SysCreateObject('WPProgram', 'De-Install', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;EXENAME='instdir'\install.cmd;ICONFILE='instdir'\deinstal.ico', 'U')
  227. retval = SysCreateObject('WPProgram', 'Read Me', '<FIM_ICONS>', 'PROGTYPE=PM;EXENAME=e.exe;PARAMETERS='instdir'\readme.1st', 'U')
  228.  
  229. 'replace 'dll' 'instdir'\fim.dll'
  230. 'del 'dll
  231. 'del 'tDrive':\os2\help\fim.hlp'
  232.  
  233. say 'Icon Heaven has been updated.'
  234. say 'You will need to reboot to make it available'
  235.  
  236. return
  237.  
  238. mkdir: procedure expose (Globals)
  239. parse arg dir
  240. if (length(dir) > 2) then do
  241.     call mkdir(substr(dir,1,lastpos('\',dir)-1))
  242.     res = SysMkDir(dir)
  243. end    
  244. if res = 5 then res = 0
  245. return res
  246.  
  247. update:
  248.  
  249. say ''
  250. say 'Icon Heaven is installed in directory ['instdir']'
  251. say 'Do you wish me to update it to version 'ver'? [Y/n]'
  252. pull reply
  253.  
  254. if left(reply,1)='N' then return
  255.  
  256. dll=instdir'\fim.dll'
  257.  
  258. 'replace 'dll
  259. 'copy fim.dll 'dll' >nul'
  260. 'copy fim.hlp 'instdir' >nul'
  261. 'copy fim.ico 'instdir' >nul'
  262. 'copy iconlib.exe 'instdir' >nul'
  263. 'copy iconlib.ico 'instdir' >nul'
  264. 'copy readme.1st 'instdir' >nul'
  265. 'copy replace.exe 'instdir' >nul'
  266. 'copy deinstal.cmd 'instdir' >nul'
  267. 'copy deinstal.ico 'instdir' >nul'
  268. 'copy reinst.cmd 'instdir' >nul'
  269.  
  270.  
  271. say 'Icon Heaven has been updated, '
  272. say 'You will need to reboot to make the new version available'
  273. 'pause'
  274.  
  275. return
  276. 
  277.